<script lang="ts">
import { defineComponent, createVNode, Fragment, toDisplayString, vShow, withDirectives, computed } from 'vue';

export default defineComponent({
  props: {
    isShowMenu: {
      type: Boolean,
      default: false,
    },
    menuMap: Object,
  },

  setup(prop) {
    const onClick = () => {
      console.log(111);
    };

    const menuStyle = computed(() => {
      const { x, y } = prop.menuMap as any;
      return {
        position: 'absolute',
        top: `${y + 10}px`,
        left: `${x + 10}px`,
      };
    });

    return {
      onClick,
      menuStyle,
    };
  },

  render(prop: any) {
    const { onClick, isShowMenu, menuStyle } = this;
    return createVNode(Fragment, null, [
      withDirectives(
          createVNode('div', {
            onClick,
            style: menuStyle ?? {},
          },
          [toDisplayString('111')],
          36,
          ['style'],
          ),
          [[vShow, isShowMenu]],
      ),
    ]);
  },
});
</script>
